<template>
  <view class="shiqinLogin flex flex-column justify-center align-center">
    <view class="bag">
      <!-- <image class="bag_image" src="@/static/shiqin-images/01.png" mode="widthFix"></image> -->
    </view>
    <view class="shiqinLogin_content flex flex-column align-center justify-center">
      <image :src="`${IMG_URL}/index/shiqinqidong.png`" style="margin-right: 34rpx;"></image>
      <view class="hW_125"></view>
      <image :src="`${IMG_URL}/index/shiqin_transparent_icon.png`" style="width: 64rpx;height: 67rpx;"></image>
      <view class="hW_23"></view>
      <text class="shiqinLogin_content_text mt_8">再小的家庭 也可以有传承</text>
    </view>
  </view>
</template>

<script setup>
  import { computed, onMounted } from 'vue';
  import sheep from '@/sheep';

  const listStyle = (top = 10) => {
    return {
      marginTop: uni.upx2px(top),
      marginBottom: 0,
      marginLeft: 0,
      marginRight: 0,
      'border-top-left-radius': 0,
      'border-top-right-radius': 0,
      'border-bottom-left-radius': 0,
      'border-bottom-right-radius': 0,
      padding: 0,
      overflow: 'hidden',
      background: {
        type: 'color',
        bgColor: '#F6F6F6',
      },
    };
  };

  const setImageStyle = (width, height) => {
    return {
      width: `${width}rpx`,
      height: `${height}rpx`,
    };
  };
  const login = computed(() => sheep.$store('user').isLogin);
  const userInfo = computed(() => sheep.$store('user').userInfo);
  const IMG_URL = computed(() => sheep.$store('AI').sq_image_path);
  // #ifdef H5
  const mode = computed(() => uni.getStorageSync('currentMode'));
  // #endif

  onMounted(() => {
    setTimeout(async () => {
      // #ifndef H5
      if (!!login.value) {
        if (!userInfo.value.surname || !userInfo.value.daimyo) {
          uni.redirectTo({
            url: '/pages/userData/sex',
          });
          return;
        }
        uni.switchTab({
          url: '/pages/message/genealogy',
        });
      } else {
        uni.switchTab({
          url: '/pages/message/genealogy',
        });
      }
      // #endif
      // #ifdef H5
      if(mode.value == 'H5'){
        if (!!login.value) {
          if (!userInfo.value.surname || !userInfo.value.daimyo) {
            uni.redirectTo({
              url: '/pages/userData/sex',
            });
            return;
          }
          uni.switchTab({
            url: '/pages/message/genealogy',
          });
        } else {
          uni.switchTab({
            url: '/pages/message/genealogy',
          });
        }
      }else{
        if (!!login.value) {
          uni.navigateTo({
            url: '/pages/pc/index',
          })
        } else {
          uni.navigateTo({
            url: '/pages/pc/login',
          })
        }
      }
      // #endif
    }, 1500);
  });
</script>


<style scoped lang="scss">
  .startupPage {
    width: 100vw;
    height: 100vh;
    background-size: 100vw 100vh;
  }

  .title_bg {
    font-family: Source Han Sans CN, Source Han Sans CN;
    font-weight: 500;
    font-size: 30rpx;
    color: #FDE2A6;
  }

  .shiqinLogin {
    /* #ifdef H5 */
    width: 100%;
    /* #endif */
    /* #ifndef H5 */
    width: 750rpx;
    /* #endif */
    min-height: 100vh;
    overflow: hidden;
    background: #FCEFDE;
    border-radius: 0rpx 0rpx 0rpx 0rpx;

    .bag {
      width: 750rpx;
      position: absolute;
      top: 0;
      left: 0;

      .bag_image {
        width: 750rpx;
      }
    }

    .shiqinLogin_content {
      // margin-top: 150rpx;
      width: 750rpx;
      z-index: 1;

      image {
        width: 501rpx;
        height: 647rpx;
      }

      .shiqinLogin_content_text {
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 25rpx;
        color: #FF4206;
      }
    }
  }
</style>
